import { reqCategoryList,reqBannerList,reqFloorList} from "@/api"

const state = {
      a: 1,
      categoryList: [],
      bannersList:[],
      floorsList:[]
}
const mutations = {
      GETCATEGORYLIST(state,categoryList){
            state.categoryList=categoryList
            // console.log(categoryList);
      },
      GETBANNERLIST(state,bannersList){
            state.bannersList=bannersList
      },
      GETFLOORLIST(state,floorsList){
            state.floorsList=floorsList
      }
}
const actions = {
      async getCategoryList({ commit }) {
            let result = await reqCategoryList()
            if (result.code == 200) {
                  commit('GETCATEGORYLIST', result.data)
            }

      },
     async getBannerList({commit}){
            let result = await reqBannerList()
            if(result.code ==200){
                  commit('GETBANNERLIST',result.data)
            }
      },
      async getFloorList({commit}){
            let result= await reqFloorList()
            if(result.code==200){
                  commit('GETFLOORLIST',result.data)
            }
      }
}
const getters = {}
export default {
      state,
      mutations,
      actions,
      getters
}